#include "Operation.h"
#include <cmath>

Operation::Operation()
{
	m_IsCount = true;
}

/**
* 功能：实现阶乘运算
* 参数：x 输入的数字
* 作者：韦锴祖
* 日期：2018-12-8
**/
double Operation::Fac(double x)
{
	double f;
	if (x == 0 || x == 1)
	{
		f = 1;
	}
	else
	{
		f = Fac(x - 1)*x;
	}
	return f;
}

/**< 阶乘运算实现 */
double Operation::OperationFac(double a)
{
		m_Result = Fac(a);
		return m_Result;
}

/**< 加法运算实现 */
double Operation::OperationAdd(double a, double b)
{
	m_Result = a + b;
	return m_Result;
}

/**< 减法运算实现 */
double Operation::OperationSub(double a, double b)
{
	m_Result = a - b;
	return m_Result;
}

/**< 乘法运算实现 */
double Operation::OperationMuti(double a, double b)
{
	m_Result = a * b;
	return m_Result;
}

/**< 除法运算实现 */
double Operation::OperationDivi(double a, double b)
{
	m_Result = a / b;
	return m_Result;
}

/**< 次方运算实现 */
double Operation::OperationPow(double a, double b)
{
	m_Result = pow(a, b);
	return m_Result;
}

/**< 取余运算实现 */
double Operation::OperationMod(double a, double b)
{
		m_Result = (int)a % (int)b;
		return m_Result;
}

